﻿using QMERP.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq;

namespace QMERP.Infrastructure.EFCore.Extensions
{
    public static class LensExtension
    {
        public static IQueryable<Lens> GetBySupplierIds(this IQueryable<Lens> query, params long[] supplierIds)
        {
            var obj = from a in query
                      from b in a.Lens_Suppliers!
                      where supplierIds.Contains(b.SupplierId)
                      select a;
            return obj.Distinct();
        }
        //public static IQueryable<User> GetByOrganizationIds(this IQueryable<User> query, int [] organizationIds)
        //{
        //    var obj = from a in query
        //              from b in a.Organization_User
        //              where  organizationIds.Contains(b.OrganizationId)
        //              select a;
        //    return obj.Distinct();
        //}
    }
}
